<template>
<div class="withdrawal-application views-container">
    <el-dialog v-if="dialogTableType === 'dealerUserMoney'" width="65%" @close="resetDialogFormData({calc: {all: '0.00',current: '0.00',ing: '0.00',total: '0.00'},data: [],total: 0,pagination: {page: 1,list_rows: 10,pagesizes: [10, 20, 50]}})" :visible.sync="dialogTableVisible" custom-class="reset-pwd wlm-form-dialog dialog-table">
        <div class="wlm-form" v-if="dialogTableVisible">
            <div class="wlm-form-header wlm-dialog-fixheader">
                <span class="wlm-dialog-inlenr">分销数据</span>
            </div>
            <el-scrollbar wrap-class="scrollbar-wrapper">
                <div class="wlm-form-content wlm-table">
                    <el-row type="flex" justify="space-around">
                        <el-col :span="4">
                            <el-card shadow="hover">
                                <div class="text-center">
                                    <p>
                                        <img class="logo" style="margin-right: 5px;" :src="userInfo.avatarUrl">
                                        <span class="ellipsis" style="width: 79px;vertical-align: middle;">{{userInfo.nickName}}</span>
                                        <el-popover placement="top-start" width="200" trigger="hover" content="用户信息">
                                            <el-button size="medium" type="text" slot="reference"><i class="el-icon-question" style="vertical-align: middle;"></i></el-button>
                                        </el-popover>
                                    </p>
                                    <p class="order-gray">ID: {{userInfo.user_id}}</p>
                                </div>
                            </el-card>
                        </el-col>
                        <el-col :span="4">
                            <el-card shadow="hover">
                                <div class="text-center">
                                    <p>
                                        提现中
                                        <el-popover placement="top-start" width="200" trigger="hover" content="提现处理中的佣金">
                                            <el-button size="medium" type="text" slot="reference"><i class="el-icon-question"></i></el-button>
                                        </el-popover>
                                    </p>
                                    <p class="text-danger">￥ {{formFormatData.formData.calc.ing}}</p>
                                </div>
                            </el-card>
                        </el-col>
                        <el-col :span="4">
                            <el-card shadow="hover">
                                <div class="text-center">
                                    <p>可提现
                                        <el-popover placement="top-start" width="200" trigger="hover" content="不包括提现中的金额">
                                            <el-button size="medium" type="text" slot="reference"><i class="el-icon-question"></i></el-button>
                                        </el-popover>
                                    </p>
                                    <p class="text-danger">￥ {{formFormatData.formData.calc.current}}</p>
                                </div>
                            </el-card>
                        </el-col>
                        <el-col :span="4">
                            <el-card shadow="hover">
                                <div class="text-center">
                                    <p>累计提现
                                        <el-popover placement="top-start" width="200" trigger="hover" content="累计提现的佣金">
                                            <el-button size="medium" type="text" slot="reference"><i class="el-icon-question"></i></el-button>
                                        </el-popover>
                                    </p>
                                    <p class="text-danger">￥ {{formFormatData.formData.calc.total}}</p>
                                </div>
                            </el-card>
                        </el-col>
                        <el-col :span="4">
                            <el-card shadow="hover">
                                <div class="text-center">
                                    <p>总佣金
                                        <el-popover placement="top-start" width="200" trigger="hover" content="累计的总佣金">
                                            <el-button size="medium" type="text" slot="reference"><i class="el-icon-question"></i></el-button>
                                        </el-popover>
                                    </p>
                                    <p class="text-danger">￥ {{formFormatData.formData.calc.all}}</p>
                                </div>
                            </el-card>
                        </el-col>
                    </el-row>
                    <el-tabs v-model="formFormatData.api.editForm.params.is_settled" type="card" style="margin-top:10px;" @tab-click="formFormatEditEvt">
                        <el-tab-pane label="普通订单" name="1"></el-tab-pane>
                        <el-tab-pane label="会员订单" name="3"></el-tab-pane>
                    </el-tabs>
                    <div class="wlm-dialog-main wlm-table-content" style="padding:16px 0 0;">
                        <div class="wlm-dialog-content">
                            <el-table :data="formFormatData.formData.data" v-if="formFormatData.api.editForm.params.is_settled=='1'" style="width: 100%">
                                <el-table-column label="订单编号" min-width="68">
                                    <template slot-scope="scope">
                                        {{scope.row.order_no}}
                                    </template>
                                </el-table-column>
                                <el-table-column label="商品/价格">
                                    <template slot-scope="scope">
                                        <div class="wlm-table-logos" v-if="scope.row.order_goods[0]">
                                            <img class="logo" v-if="scope.row.order_goods[0]['image']&&scope.row.order_goods[0]['image']['file_path']" :src="scope.row.order_goods[0]['image']['file_path']">
                                            <div class="inner-text" style="width: 100px;">
                                                <p class="ellipsis" style="width: 130px;">{{scope.row.order_goods[0]['goods_name']}}</p>
                                                <p>￥{{scope.row.order_goods[0]['total_pay_price']}}</p>
                                            </div>
                                        </div>
                                    </template>
                                </el-table-column>
                                <el-table-column  label="购买人" min-width="55">
                                    <template slot-scope="scope">
                                        <div class="wlm-table-logos">
                                            <img class="logo" :src="scope.row.avatarUrl">
                                            <div class="inner-text ellipsis" style="width: 85px;">
                                                <p>{{scope.row.nickName}}</p>
                                            </div>
                                        </div>
                                    </template>
                                </el-table-column>
                                <el-table-column min-width="35" label="关系">
                                    <template slot-scope="scope">
                                        <span v-if="scope.row.referee">{{scope.row.referee[1]}}</span>
                                        <span v-else>-</span>
                                    </template>
                                </el-table-column>
                                <el-table-column min-width="35" label="订单状态">
                                    <template slot-scope="scope">
                                        <span v-if="scope.row.is_settled!=1">{{scope.row.state_text}}</span>
                                        <span v-if="scope.row.is_settled==1">已完成</span>
                                    </template>
                                </el-table-column>
                                <el-table-column min-width="35" label="结算状态">
                                    <template slot-scope="scope">
                                        <span>{{scope.row.is_settled==0?'未结算':scope.row.is_settled==1?'已结算':scope.row.is_settled==2?'结算中':''}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column min-width="40" label="入账佣金">
                                    <template slot-scope="scope">
                                        <span v-if="scope.row.checked">{{scope.row.checked.checkMoney}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column label="入账时间" min-width="70">
                                    <template slot-scope="scope">
                                        <span v-if="scope.row.settle_time!=0">{{scope.row.settle_time*1000 | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}</span>
                                        <span v-if="scope.row.settle_time==0">-</span>
                                    </template>
                                </el-table-column>
                            </el-table>
                            <!-- 会员 -->
                            <el-table :data="formFormatData.formData.data" v-if="formFormatData.api.editForm.params.is_settled=='3'" style="width: 100%">
                                <el-table-column label="订单编号" min-width="70">
                                    <template slot-scope="scope">
                                        {{scope.row.order_no}}
                                    </template>
                                </el-table-column>
                                <el-table-column label="商品/价格">
                                    <template slot-scope="scope">
                                        <div class="wlm-table-logos">
                                            <div class="inner-text" style="width: 100px;">
                                                <p class="ellipsis" style="width: 130px;">{{scope.row.goods_name}}</p>
                                                <p>￥{{scope.row.pay_price}}</p>
                                            </div>
                                        </div>
                                    </template>
                                </el-table-column>
                                <el-table-column  label="购买人" min-width="55">
                                    <template slot-scope="scope">
                                        <div class="wlm-table-logos">
                                            <img class="logo" :src="scope.row.avatarUrl">
                                            <div class="inner-text ellipsis" style="width: 85px;">
                                                <p>{{scope.row.nickName}}</p>
                                            </div>
                                        </div>
                                    </template>
                                </el-table-column>
                                <el-table-column min-width="35" label="关系">
                                    <template slot-scope="scope">
                                        <span v-if="scope.row.referee">{{scope.row.referee[1]}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column min-width="40" label="入账佣金">
                                    <template slot-scope="scope">
                                        {{scope.row.rebate_commission}}
                                    </template>
                                </el-table-column>
                                <el-table-column min-width="35" label="订单状态">
                                    <template slot-scope="scope">
                                        <span v-if="scope.row.is_settled!=1">{{scope.row.state_text}}</span>
                                        <span v-if="scope.row.is_settled==1">已完成</span>
                                    </template>
                                </el-table-column>
                                <el-table-column min-width="35" label="结算状态">
                                    <template slot-scope="scope">
                                        <span>{{scope.row.is_settled==0?'未结算':scope.row.is_settled==1?'已结算':scope.row.is_settled==2?'结算中':''}}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column label="入账时间" min-width="70">
                                    <template slot-scope="scope">
                                        {{scope.row.create_time}}
                                    </template>
                                </el-table-column>
                            </el-table>
                        </div>
                        <div class="pagination-content flex-row flex-justify-b flex-align-c">
                            <el-row class="pagination-btns">
                            </el-row>
                            <el-pagination :disabled="formFormatData.formData.data.length === 0" @current-change="formPageChange" :current-page.sync="formFormatData.formData.pagination.page" :page-sizes="formFormatData.formData.pagination.pagesizes" :page-size.sync="formFormatData.formData.pagination.list_rows" layout="total, sizes, prev, pager, next, jumper" :total="formFormatData.formData.data.length > 0 ? formFormatData.formData.total : 0">
                            </el-pagination>
                        </div>
                    </div>
                </div>
            </el-scrollbar>
        </div>
        <footer class="flex-row flex-align-c flex-justify-c wlm-dialog-fixfooter">
            <el-button size="small" type="primary" @click="dialogTableVisible=false">确定</el-button>
        </footer>
    </el-dialog>
    <el-dialog :visible.sync="dialogVisibleImg" width="30%" custom-class="reset-pwd wlm-form-dialog dialog-table">
        <div class="wlm-form">
            <div class="wlm-form-header wlm-dialog-fixheader">
                <span class="wlm-dialog-inlenr">驳回原因</span>
            </div>
            <p style="padding:20px;min-height:200px">{{openDialogText}}</p>
        </div>
    </el-dialog>
    <el-dialog v-if="dialogTableType === 'WithdrawToExamine'" @close="resetDialogFormData" :visible.sync="dialogTableVisible" custom-class="reset-pwd wlm-form-dialog dialog-table">
        <div class="wlm-form" v-if="dialogTableVisible">
            <div class="wlm-form-header wlm-dialog-fixheader">
                <span class="wlm-dialog-inlenr">分销商审核</span>
            </div>
            <el-scrollbar wrap-class="scrollbar-wrapper">
                <div class="wlm-form-content">
                    <div class="wlm-dialog-main">
                        <div class="wlm-dialog-content">
                            <el-form ref="userForm" :model="formFormatData.formData" :rules="formFormatData.rules" size="small" label-width="120px" class="retail-form" label-position="right">
                                <el-form-item label="审核状态" prop="name">
                                    <el-radio-group v-model="formFormatData.formData.status">
                                        <!-- <el-radio label="10">待审核</el-radio> -->
                                        <el-radio label="20">审核通过</el-radio>
                                        <el-radio label="30">驳回</el-radio>
                                    </el-radio-group>
                                </el-form-item>
                                <el-form-item label="原因" prop="merchantlog" v-if="formFormatData.formData.status=='30'">
                                    <el-input type="textarea" :autosize="{ minRows: 4, maxRows: 4}" v-model.trim="formFormatData.formData.content">
                                    </el-input>
                                </el-form-item>
                            </el-form>
                        </div>
                    </div>
                </div>
            </el-scrollbar>
        </div>
        <footer class="flex-row flex-align-c flex-justify-c wlm-dialog-fixfooter">
            <el-button size="small" type="primary" @click="saveContent" :loading="loading12">确定</el-button>
        </footer>
    </el-dialog>
    <div class="wlm-table" v-loading="f_loading.loading">
        <div class="wlm-table-header" style="margin-bottom:20px;">
            <div class="dashboard-header">
                <el-row type="flex" :gutter="20" justify="space-between">
                    <el-col :span="4">
                        <div class="dashboard-header-item flex-col flex-justify-c flex-align-c">
                            <div class="item-title">提现总金额</div>
                            <div class="item-num">
                                <span class="text-danger">￥</span><span>{{categoryData.total_money}}</span>
                            </div>
                        </div>
                    </el-col>
                    <el-col :span="4">
                        <div class="dashboard-header-item flex-col flex-justify-c flex-align-c">
                            <div class="item-title">提现处理中</div>
                            <div class="item-num">
                                <span class="text-danger">￥</span><span>{{categoryData.wait_money}}</span>
                            </div>
                        </div>
                    </el-col>
                    <el-col :span="4">
                        <div class="dashboard-header-item flex-col flex-justify-c flex-align-c">
                            <div class="item-title">提现总用户</div>
                            <div class="item-num">
                                <span>{{categoryData.total_user}}</span>
                            </div>
                        </div>
                    </el-col>
                    <el-col :span="4">
                        <div class="dashboard-header-item flex-col flex-justify-c flex-align-c">
                            <div class="item-title">提现总金额较上月增长率</div>
                            <div class="item-num">
                                <span>{{categoryData.sumIncrease}}%</span>
                            </div>
                        </div>
                    </el-col>
                    <el-col :span="4">
                        <div class="dashboard-header-item flex-col flex-justify-c flex-align-c ">
                            <div class="item-title">提现用户较上月增长率</div>
                            <div class="item-num">
                                <span>{{categoryData.userIncrease}}%</span>
                            </div>
                        </div>
                    </el-col>
                </el-row>
            </div>
        </div>
        <!-- {{f_loding}} -->
        <div class="wlm-table-header">
            <el-form :model="tableFormatData.userTable.files" size="small" label-width="80px" class="retail-form" label-position="right">
                <el-form-item label="" class="filter">
                    <el-form-item label="用户：" class="search">
                        <el-input @keyup.enter.native="filesSerch" v-model="tableFormatData.userTable.files.nickName" style="width:160px;"></el-input>
                    </el-form-item>
                    <el-form-item label="提现方式：" class="search">
                        <el-select v-model="tableFormatData.userTable.files.pay_type" placeholder="请选择">
                            <el-option v-for="item in [{lable:'全部',value:'0'},{lable:'微信',value:'10'},{lable:'支付宝',value:'20'},{lable:'银行卡',value:'30'}]" :key="item.value" :label="item.lable" :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-form-item>
                <el-form-item label="" class="filter-btns">
                    <el-button type="primary" @click="filesSerch">筛选</el-button>
                    <el-button type="text" @click="filesEmpty">清空筛选条件</el-button>
                </el-form-item>
            </el-form>
        </div>
        <el-tabs v-model="tableFormatData.userTable.files.apply_status" type="card" @tab-click="filesSerch">
            <!-- @tab-click="filesSerch" -->
            <el-tab-pane label="全部申请" name="0"></el-tab-pane>
            <el-tab-pane label="待审核" name="10"></el-tab-pane>
            <el-tab-pane label="待打款" name="20"></el-tab-pane>
            <el-tab-pane label="已打款" name="40"></el-tab-pane>
            <el-tab-pane label="已驳回" name="30"></el-tab-pane>
        </el-tabs>
        <div class="wlm-table-content">
            <el-table :ref="tableFormatData.userTable.key" :data="tableFormatData.userTable.tableData" @selection-change="handleSelectionChange" style="width: 100%">
                <el-table-column v-if="tableFormatData.userTable.files.apply_status == '20' || tableFormatData.userTable.files.apply_status == '10'" type="selection" width="55">
                </el-table-column>
                <el-table-column prop="date" label="用户" min-width="45">
                    <template slot-scope="scope">
                        <div class="wlm-table-logos">
                            <img class="logo" :src="scope.row.avatarUrl">
                            <div class="inner-text">
                                <p>{{scope.row.nickName}}</p>
                                <span>ID:{{scope.row.user_id}}</span>
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column prop="name" label="姓名/电话" min-width="40">
                    <template slot-scope="scope">
                        <p v-show="scope.row.pay_type.value==10">{{scope.row.nickName||'-'}}</p>
                        <p v-show="scope.row.pay_type.value==20">{{scope.row.alipay_name||'-'}}</p>
                        <p v-show="scope.row.pay_type.value==30">{{scope.row.bank_account||'-'}}</p>
                        <p>{{scope.row.mobile}}</p>
                    </template>
                </el-table-column>
                <el-table-column prop="name" label="提现方式" min-width="35">
                    <template slot-scope="scope">
                        <span>{{scope.row.pay_type.text}}</span>
                        <el-popover trigger="hover" placement="top" v-if="scope.row.pay_type.text=='银行卡'">
                            <div>
                                <p>银行：{{scope.row.bank_name}}</p>
                                <p>卡号：{{scope.row.bank_card}}</p>
                                <p>手机号：{{scope.row.mobile}}</p>
                            </div>
                            <span style="cursor: pointer;margin-left:6px;" slot="reference"><i class="el-icon-warning orders-blue"></i></span>
                        </el-popover>
                        <el-popover trigger="hover" placement="top" v-if="scope.row.pay_type.text=='支付宝'">
                            <div>
                                <p>支付宝账号：{{scope.row.alipay_account}}</p>
                                <p>支付宝姓名：{{scope.row.alipay_name}}</p>
                            </div>
                            <span style="cursor: pointer;margin-left:6px;" slot="reference"><i class="el-icon-warning orders-blue"></i></span>
                        </el-popover>
                    </template>
                </el-table-column>
                <el-table-column prop="name" label="申请金额" min-width="33">
                    <template slot-scope="scope">
                        <span class="text-danger">￥{{scope.row.money}}
                        </span>
                        <!-- <el-tooltip class="item" effect="dark" :content="sourceType[`${scope.row.source}`]" placement="top">
                            <img height="20" width="20" :src="sourceImg[`${scope.row.source || '--'}`]" alt="">
                        </el-tooltip> -->
                    </template>
                </el-table-column>
                <el-table-column prop="name" label="手续费" min-width="33">
                    <template slot-scope="scope">
                        <span class="text-danger">￥{{scope.row.commission}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="name" label="到账" min-width="33">
                    <template slot-scope="scope">
                        <span class="text-danger">￥{{((scope.row.money*100-scope.row.commission*100)/100).toFixed(2)}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="name" label="申请状态" min-width="45">
                    <template slot-scope="scope">
                       <div style="display:flex;align-items: center;">
                             <div v-if="scope.row.audit_free==1">
                                <el-tag type="success" size="mini">免</el-tag>
                            </div>
                           <div>
                        <span v-if="scope.row.apply_status==10">待审核</span>
                        <span v-if="scope.row.apply_status==20">审核通过/待打款</span>
                        <span v-if="scope.row.apply_status==30">驳回</span>
                        <span v-if="scope.row.apply_status==40">已打款</span>
                           </div>
                       </div>
                     
                    </template>

                </el-table-column>
                <el-table-column prop="name" label="申请时间" min-width="48">
                    <template slot-scope="scope">
                        <span>{{ scope.row.create_time}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="name" label="审核时间" min-width="48">
                    <template slot-scope="scope">
                        <span>{{ scope.row.audit_time || '-' }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="操作" min-width="62">
                    <template slot-scope="scope">
                        <div class="operation-group">
                            <el-button v-if="scope.row.apply_status==10" class="wlm-text" type="text" @click="changeFormatType('WithdrawToExamine');formFormatDialogEditEvt({redirect:'ids',id:[scope.row.id],toggle:'dialogTableVisible',noEdit:true})">审核</el-button>
                            <el-button v-if="scope.row.apply_status==20" class="wlm-text" type="text" @click="changeFormatType('WithdrawToExamine');changeTableItem({id:scope.row.id},tableFormatData.userTable.change.flag,{isWarning: true,warning:'是否标记已打款？',cancel:'已取消'})">标记已打款</el-button>
                            <div v-if="scope.row.apply_status==20" class="btn-line"></div>
                            <el-button v-if="scope.row.apply_status==20"  class="wlm-text" type="text" @click="paymentbtn(scope.row.id)">确认打款</el-button>
                            <!-- <el-button v-if="scope.row.apply_status==30 || scope.row.apply_status==40" class="wlm-text" type="text" @click="changeFormatType('WithdrawToExamine');delTableItem(scope.row.id)">删除</el-button> -->
                            <!-- <div v-if="scope.row.apply_status!==30||scope.row.apply_status!==40" class="btn-line"></div> -->
                            <el-button v-if="scope.row.apply_status==30" class="wlm-text" type="text" @click="changeFormatType('WithdrawToExamine');openDialog(scope.row.reject_reason)">驳回原因</el-button>
                            <div class="btn-line" v-if="scope.row.apply_status!==40"></div>
                            <el-button class="wlm-text" type="text" size="small" @click="changeFormatType('dealerUserMoney');userInfo = { user_id:scope.row.user_id,nickName: scope.row.nickName, avatarUrl: scope.row.avatarUrl}; formFormatDialogEditEvt({id:scope.row.user_id, toggle:'dialogTableVisible'})">佣金</el-button>
                        </div>
                    </template>
                </el-table-column>
            </el-table>
            <div class="pagination-content flex-row flex-justify-b flex-align-c">
                <el-row class="pagination-btns">
                    <el-checkbox class="check-all" v-if="tableFormatData.userTable.files.apply_status == '20' || tableFormatData.userTable.files.apply_status == '10'" true-label="1" false-label="0" v-model="tableFormatData.userTable.files.checkall" @change="toggleSelection">全部</el-checkbox>
                    <el-button class="right-8" v-if="tableFormatData.userTable.files.apply_status == '20'" :disabled="isGroup" @click="changeTableItem({isGroup:true},tableFormatData.userTable.change.refund,{isWarning: true,warning:'是否确认打款？',cancel:'已取消'},f_loading)" type="primary" size="mini">批量打款</el-button>
                    <el-button class="right-8" v-if="tableFormatData.userTable.files.apply_status == '10'" :disabled="isGroup" size="mini" @click="auditBatch">批量审核</el-button>
                </el-row>
                <el-pagination :disabled="!hasTableData" @size-change="listPageChange" @current-change="listPageChange" :current-page.sync="tableFormatData.userTable.pagination.page" :page-sizes="tableFormatData.userTable.pagination.pagesizes" :page-size.sync="tableFormatData.userTable.pagination.list_rows" layout="total, sizes, prev, pager, next, jumper" :total="hasTableData?tableFormatData.userTable.pagination.total : 0">
                </el-pagination>
            </div>
        </div>
    </div>
</div>
</template>

<script>
import {
  getWithdrawList,
  getWithdrawStatistical,
  delWithdrawInfo,
  WithdrawToExamine,
  withdrawPayment,
  dealerUserMoney,
  confirmationPayment
} from '@/api/distribution'
import mixins from '@/mixins/mixins'
export default {
  mixins: [mixins.getters('Table'), mixins.getters('Form')],
  name: 'WithdrawalApplication',
  components: {

  },
  created() {
    getWithdrawStatistical().then((response) => {
      const {
        data: {
          data: msgData = []
        }
      } = response
      this.categoryData = msgData
    })
  },
  data() {
    return {
        f_loading:{
            loading:false,
        },
        loading12:false,
      dialogTableVisible: false,
      dialogTableType: 'WithdrawToExamine',
      categoryData: {},
      dialogVisibleImg: false,
      openDialogText: '',
      userInfo: {
        nickName: '',
        user_id: '',
        avatarUrl: ''
      },
      tableFormatData: {
        current: 'userTable',
        userTable: {
          key: 'userTable',
          loding:false,
          api: {
            getList: getWithdrawList,
            delList: delWithdrawInfo,
            msgConfig: {
              del: {
                type: 'warning',
                msg: '是否确认删除分销申请？'
              }
            }
          },
          tableData: [],
          files: {
            nickName: '',
            pay_type: '',
            apply_status: '',
            ids: [],
            checkall: '0',
            Recycle: '1'
          },
          change: {
            refund: {
              name: '退款',
              key: 'refund',
              api: withdrawPayment
            },
            flag: {
              name: '标记打款',
              key: 'refund',
              api: confirmationPayment
            }
          },
          pagination: {
            page: 1,
            list_rows: 10,
            pagesizes: [10, 20, 50],
            total: 0
          }
        }
      },
      formFormatData: {
        key: 'userForm',
        model: {
          noCreateEdit: false,
          bindDialog: 'dialogTableVisible'
        },
        api: {
          editForm: {
            api: WithdrawToExamine,
            params: {
              id: ''
            },
            redirect: 'ids'
          },
        //   submitForm: WithdrawToExamine
        },
        formData: {
          ids: [],
          content: '',
          status: '20'
        },
        rules: {}
      }
    }
  },
  methods: {
// <!-- changeFormatType('WithdrawToExamine');changeTableItem({ids:[scope.row.id]},tableFormatData.userTable.change.refund,{isWarning: true,warning:'是否确认打款？',cancel:'已取消'}) -->
      paymentbtn(id){
            this.$confirm('是否确认打款?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
                }).then(() => {
                    this.f_loading.loading = true
                    withdrawPayment({ids:[id]}).then(res=>{
                        console.log("dssssssssaaaaaaaa",res)
                        if(res.data.data==1){
                            this.f_loading.loading = false
                            this.filesSerch()
                        }
                    }).finally(()=>{
                            this.filesSerch()
                        this.f_loading.loading=false
                    })
              
                }).catch(() => {
                        this.f_loading.loading=false
                this.$message({
                    type: 'info',
                    message: '已取消!'
                });          
                });
      },
    formPageChange(page) {
      this.formFormatData.api.editForm.params.page = page
      this.formFormatEditEvt(true)
    },
    changeFormatType(type) {
      this.dialogTableType = type
      switch (type) {
        case 'dealerUserMoney':
          this.formFormatData = {
            key: 'formFormat',
            model: {
              noCreateEdit: false,
              bindDialog: 'dialogTableVisible'
            },
            api: {
              editForm: {
                api: dealerUserMoney,
                params: {
                  page: 1,
                  is_settled: '1'
                },
                redirect: 'user_id'
              }
            },
            formData: {
              calc: {
                all: '0.00',
                current: '0.00',
                ing: '0.00',
                total: '0.00'
              },
              data: [],
              total: 0,
              pagination: {
                page: 1,
                list_rows: 10,
                pagesizes: [10, 20, 50]
              }
            },
            rules: {}
          }
          break
        case 'WithdrawToExamine':
          this.formFormatData = {
            key: 'userForm',
            model: {
              noCreateEdit: false,
              bindDialog: 'dialogTableVisible'
            },
            api: {
              editForm: {
                api: WithdrawToExamine,
                params: {
                  id: ''
                },
                redirect: 'ids'
              },
              submitForm: WithdrawToExamine
            },
            formData: {
              ids: [],
              content: '',
              status: '20'
            },
            rules: {}
          }
          break
      }
    },
    openDialog(params) {
      this.openDialogText = params
      this.dialogVisibleImg = true
    },
    changeTableCallBack(params) {

    },
    saveContent() {
    //   this.formFormatSubmit()
    this.loading12 = true
    WithdrawToExamine(this.formFormatData.formData).then(res=>{
        console.log("fdsfdsfdsfd ",res)
        if(res.data.code==1){
            this.dialogTableVisible = false
            this.$message.success(res.data.msg)
            this.loading12 = false
            this.filesSerch()
        }
    })
    },
    auditBatch() {
      var array = []
      this.tableFormatData.userTable.files.ids.map((item) => {
        array.push(item.id)
      })
      this.formFormatDialogEditEvt({ id: array, toggle: 'dialogTableVisible', noEdit: true })
    }
  }
}
</script>

<style lang="scss" scoped>
.withdrawal-application {}
</style>
